package com.jinzhi.jzweb.service.impl;

import com.jinzhi.common.utils.StringUtil;
import com.jinzhi.jzweb.pojo.bo.ExpenseTotalBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jinzhi.jzweb.dao.RefundDao;
import com.jinzhi.jzweb.domain.RefundDO;
import com.jinzhi.jzweb.service.RefundService;
import com.jinzhi.common.base.CoreServiceImpl;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 
 * <pre>
 * 
 * </pre>
 * <small> 2022-02-25 10:15:00 | lance</small>
 */
@Service
public class RefundServiceImpl extends CoreServiceImpl<RefundDao, RefundDO> implements RefundService {
    @Autowired
    private RefundDao refundDao;


    @Override
    public List<RefundDO> listRefund(Map map) {
        if(map.get("pageNumber")!=null){
            if(map.get("pageNumber").toString().equals("1")){
                map.put("pageNumber",0);
            }else {
                Integer number=(Integer) map.get("pageNumber")-1;
                Integer pageSize=(Integer) map.get("pageSize");
                Integer num=number * pageSize;
                map.put("pageNumber",num);
            }
        }
        return refundDao.listRefund(map);
    }

    @Override
    public Integer listRefundCount(Map map) {

        return refundDao.listRefundCount(map);
    }

    @Override
    public List<RefundDO> listRefunds(Map map) {
        return refundDao.listRefunds(map);
    }

    @Override
    public int batchMax() {
        Integer max = refundDao.batchMax();
        return max==null?100000:max+1;
    }

    @Override
    public ExpenseTotalBO moneyTotal(Map map) {
        return refundDao.selectMoneyTotal(map);
    }
}
